<?php

declare(strict_types=1);
/**
 * This file is part of habo_new_media.
 *
 * @link     https://www.berlen.cn/
 * @contact  tech@berlen.cn
 * @license  http://gitlab.rehou.cn/habo/habo_new_media/-/blob/master/README.md
 */
namespace app\command;

use app\service\batch\kuaishou\PicPushService;
use think\console\Input;
use think\console\Output;

class KsAutoPushPicWork extends BaseWork
{
    protected function configure()
    {
        $this->setName('ks_auto_push_pic');
        $this->setDescription('快手自动推送图片');
    }

    protected function execute(Input $input, Output $output)
    {
        set_time_limit(0);
        ini_set('memory_limit', '-1');
        $output->writeln('快手自动批量推送图片开始==========' . date('Y-m-d H:i:s') . '==========');
        $start = time();

        $advertiserId = '22323445';
        $targetAdvertiserIds = [
            '22323446',
        ];
        $filter = [
            'start_time' => 1697990400,
            'end_time' => 1698854399,
            //            'limit' => 1000,
        ];
        $picService = new PicPushService();
        $picService->pushPic($advertiserId, $targetAdvertiserIds, $filter);
        $output->writeln('快手自动批量推送图片结束==========' . date('Y-m-d H:i:s') . '==========，总用时：' . round((time() - $start) / 60, 2) . '分钟');
    }
}
